﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace SA2012TBRace
{
	public class RaceSummery
	{
		public double TotalDistanceAllRacersInKm { get; set; }
		public int TotalNumberOfCachesVisited { get; set; }
		public int TotalNumberOfCountriesVisisted { get; set; }
	}

	public class Trackable
	{
		public string Code { get; set; }
		public string Name { get; set; }
		public string Owner { get; set; }
		public string Country { get; set; }
		public string State { get; set; }
		public string County { get; set; }
		public double Latitude { get; set; }
		public double Longitude { get; set; }
		public string RaceType { get; set; }
		public string TrackableType { get; set; }		// UserData
		public string TrackableParentName { get; set; }	// User3
		public double TotalDistance { get; set; }

		public double SinglePersonDropDistance { get; set; }
		public string CachesDroppedInto { get; set; }
        public string CachesDroppedIntoDifficult { get; set; }
		public int NumberOfCachesVisited { get; set; }
        public int TimesDiscovered { get; set; }

        /*
        public double FebPoints 
        { get
            {
                Double febPoints=0;
                // double points for discoveries
                foreach()
                {

                }

                // double points for visited
                // double points for cito
                // double points for megas
                // double points for events
                return febPoints;
            }; 
         set; 
        }
        */
		

		public IEnumerable<string> CountriesVisited { get; set; }
		public IEnumerable<string> StatesVisited { get; set; }
        public IEnumerable<string> EventsVisited { get; set; }
		public IEnumerable<string> CitosVisited { get; set; }
		public IEnumerable<string> MegasVisited { get; set; }
		public IEnumerable<string> TbHotelsVisited { get; set; }
        public IEnumerable<string> FebQualifyingCaches { get; set; }
		
		public int Times750Km { get { return (int) (TotalDistance/750); } }
        public int TimesTo100Km { get { return (int)(TotalDistance / 100); } }

        // standard point multipliers used to calculate points
        // can be overridden if required.
        public int TimesDiscoveredMultiplier = 5;
        public int NumberOfCachesVisitedMultiplier = 10;
        public int CountriesVisitedMultiplier = 20;
        public int CountryStatesVisitedMultiplier = 15;
        public int CitosVisitedMultiplier = 30;
        public int MegasVisitedMultiplier = 200;
        public int TbHotelsVisitedMultiplier = 15;
        public int EventsVisitedMultipler = 10;

        // points calculations
		public int DiscoveryPoints { get { return TimesDiscovered * TimesDiscoveredMultiplier; } }
		public int CacheVisitedPoints { get { return NumberOfCachesVisited * NumberOfCachesVisitedMultiplier; } }
		public int CountriesVisitedPoints { get { return CountriesVisited.Count() * CountriesVisitedMultiplier; } }
        public int CountryStatesVisitedPoints { get { return StatesVisited.Count() * CountryStatesVisitedMultiplier; } }
		public int CitosVisistedPoints { get { return CitosVisited.Count() * CitosVisitedMultiplier; } }
		public int MegasVisitedPoints { get { return MegasVisited.Count() * MegasVisitedMultiplier; } }
		public int TbHotelsVisitedPoints { get { return TbHotelsVisited.Count() * TbHotelsVisitedMultiplier; } }
		public int Times750KmPoints { get { return Times750Km * 75; } }
        public int EventsVisitedPoints { get { return EventsVisited.Count() * EventsVisitedMultipler; } }
      

       
        // TODO: Modify this to include new point options
		public int TotalPoints
		{
			get
			{
				//if (RaceType == "Points")
					return DiscoveryPoints + CacheVisitedPoints + CountriesVisitedPoints + CountryStatesVisitedPoints +
						   CitosVisistedPoints + MegasVisitedPoints + TbHotelsVisitedPoints + TimesTo100Km;

				//return (int)SinglePersonDropDistance;
			}
		}

        
    }

	public class ItemLog
	{
		public int LogId { get; set; }
		public string LogType { get; set; }
		public string Location { get; set; }
		public string ByCacher { get; set; }
		public DateTime Date { get; set; }
		public double? Latitude { get; set; }
		public double? Longitude { get; set; }

		public override string ToString()
		{
			return String.Format("Date: {0}, LogType: {1}",
				Date,
				LogType);
		}
	}

	public class LocationInfo
	{
		public string CountryCode { get; set; }
		public string CountryName { get; set; }
		public string State { get; set; }
		public string Area { get; set; }
		public string GcCode { get; set; }

		public override string ToString()
		{
			return
				String.Format("Country: {0}, State: {1}, Area: {2}, GC: {3}",
				CountryCode,
				State,
				Area,
				GcCode);
		}
	}

	public class CacheInfo
	{
		public string Code { get; set; }
		public string Name { get; set; }
		public string CacheType { get; set; }
		public string Country { get; set; }
		public string State { get; set; }
		public string County { get; set; }
		public double Elevation { get; set; }
		public double Longitude { get; set; }
		public double Latitude { get; set; }
		public string Container { get; set; }
	}
}
